package com.zhanghe.security.authenticationtoken;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

public class RefreshTokenAuthenticationToken extends AbstractAuthenticationToken {

    private String refreshToken;

    private String userName;

    public RefreshTokenAuthenticationToken( String refreshToken) {
        super(null);
        this.refreshToken = refreshToken;
    }

    public RefreshTokenAuthenticationToken(Collection<? extends GrantedAuthority> authorities, String userName) {
        super(authorities);
        this.userName = userName;
    }

    @Override
    public Object getCredentials() {
        return null;
    }

    @Override
    public Object getPrincipal() {
        return refreshToken;
    }

    public String getRefreshToken() {
        return refreshToken;
    }

    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
}
